package ithink.link.base.service;

import java.util.List;

/**
 * Created by zaqb on 17-9-10.
 */
public interface IConfigMonitor<T> {
    void createPersistentConfig(String path, T object) throws Exception;

    void createTemporaryConfig(String path, T object) throws Exception;

    void deleteConfig(String path);

    T getConfig(String path) throws Exception;

    List<T> getValues();

    void setConfig(String path, T config) throws Exception;

    void setListener(IListener<T> listener);

    void start() throws Exception;

    void stop();

    boolean tryCreateTemporaryPath(String path, T object) throws Exception;

    interface IListener<T> {
        void onError();

        void onNewSession();

        void onObjectCreated(List<T> created);

        void onObjectDeleted(List<T> deleted);

        void onObjectUpdated(List<T> updated);

        void onSessionExpired();
    }
}